package com.recsmile.sgs.client.commonds.sync;

import java.util.Collections;

import com.recsmile.sgs.client.commonds.GeneralGameUIClientCommand;
import com.recsmile.sgs.client.entity.Hero;
import com.recsmile.sgs.client.entity.InvalidPlayerCommandException;
import com.recsmile.sgs.client.entity.PlayerSimple;
import com.recsmile.sgs.client.ui.components.GamePanel;

public class SyncOtherPlayerCardGameUIClientCommand extends GeneralGameUIClientCommand {

	private static final long serialVersionUID = 7418973417086495080L;
	
	private final String name;
	private final boolean add;
	private final int amount;
	
	public SyncOtherPlayerCardGameUIClientCommand(String name, boolean add, int amount) {
		this.name = name;
		this.add = add;
		this.amount = amount;
	}

	@Override
	public void execute(GamePanel<? extends Hero> panel) {
		PlayerSimple player = panel.getContent().getPlayer(name);
		if (add) {
			//player.addCards(Collections.nCopies(amount, null));
		} else {
			for (int i = 0; i < amount; i++) {
				try {
					player.removeCardFromHand(null);
				} catch (InvalidPlayerCommandException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
